package cz.muni.fi.pv112.cranesimulator.models.crane.parts;

import cz.muni.fi.pv112.cranesimulator.models.OBJModel;
import cz.muni.fi.pv112.cranesimulator.scene.Scene;

/**
 *
 * @author Michal Ďuriš
 */
public class Magnet extends OBJModel {

    public static final float MAGNET_HEIGHT = 4.0f;
    public static final float MAGNET_RADIUS = 7.0f;

    public static final float[] CATCHING_ZONE_CENTER_POINT_START_POSITION = {
        -37.0f, 111.0f, 0.0f};

    private final float[] catchingZoneCenterPointCurrentPosition = {-37.0f,
                                                                    111.0f,
                                                                    0.0f};

    public Magnet() {
        super();

        path = "/cz/muni/fi/pv112/cranesimulator/resources/models/crane/parts/magnet.obj";
    }

    public float[] getCatchingZoneCenterPointCurrentPosition() {
        return catchingZoneCenterPointCurrentPosition;
    }

    public void moveCatchingZoneCenterPointTo(float x, float y, float z) {
        catchingZoneCenterPointCurrentPosition[Scene.X_AXIS] = x;
        catchingZoneCenterPointCurrentPosition[Scene.Y_AXIS] = y;
        catchingZoneCenterPointCurrentPosition[Scene.Z_AXIS] = z;
    }

    public void moveCatchingZoneCenterPointBy(float x, float y, float z) {
        catchingZoneCenterPointCurrentPosition[Scene.X_AXIS] += x;
        catchingZoneCenterPointCurrentPosition[Scene.Y_AXIS] += y;
        catchingZoneCenterPointCurrentPosition[Scene.Z_AXIS] += z;
    }

    public void moveCatchingZoneCenterPointFromStartBy(float x, float y, float z) {
        catchingZoneCenterPointCurrentPosition[Scene.X_AXIS] = CATCHING_ZONE_CENTER_POINT_START_POSITION[Scene.X_AXIS]
                + x;
        catchingZoneCenterPointCurrentPosition[Scene.Y_AXIS] = CATCHING_ZONE_CENTER_POINT_START_POSITION[Scene.Y_AXIS]
                + y;
        catchingZoneCenterPointCurrentPosition[Scene.Z_AXIS] = CATCHING_ZONE_CENTER_POINT_START_POSITION[Scene.Z_AXIS]
                + z;
    }

    public float getCatchingZoneHeight() {
        return catchingZoneCenterPointCurrentPosition[Scene.Y_AXIS];
    }

}
